package com.mzj.saas.mservice.lock.Repository;

import com.mzj.saas.mservice.lock.entity.HouseLockFrozenLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

public interface HouseLockFrozenLogRepository extends PagingAndSortingRepository<HouseLockFrozenLog, Long>, JpaSpecificationExecutor<HouseLockFrozenLog> {
    @Query(value = "select * from  saas_house_lock_frozen_log where lock_id=?1  and lock_audit_id = ?2 and type =?3 GROUP BY operation_time DESC LIMIT 1", nativeQuery = true)
    HouseLockFrozenLog findByLockIdAndLockAuditIdAndType(Long lockId, Long lockAuditId, Integer type);

    @Query(value = "select * from  saas_house_lock_frozen_log where lock_id=?1  and type =?2 GROUP BY operation_time DESC LIMIT 1", nativeQuery = true)
    HouseLockFrozenLog findByLockIdAndType(Long lockId, Integer type);

}

